const {
  onShopHook,
  getShopHome,
  getShopList,
  getGoodsList,
  getGoodsInfo,
  getShopDetail,
  getBanners,
} = require("../service/ice/shop");

const app = require("express").Router();

app.all("/hook", (req, res) => {
  onShopHook(req._body);
  res.send("ok");
});

app.get("/home", async (req, res) => {
  const data = await getShopHome(req.query);
  res.send(data);
});

app.get("/shop-list", async (req, res) => {
  const data = await getShopList(req.query);
  res.send(data);
});

app.get("/shop-info", async (req, res) => {
  const data = await getShopDetail(req.query);
  res.send(data);
});

app.get("/banner-list", async (req, res) => {
  const data = await getBanners(req.query);
  res.send(data);
});

app.get("/goods-list", async (req, res) => {
  const data = await getGoodsList(req.query);
  res.send(data);
});

app.get("/goods-info", async (req, res) => {
  const data = await getGoodsInfo(req.query);
  res.send(data);
});

module.exports = app;
